<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<!DOCTYPE html>
<html>
<head>
	<title>修改密码</title>
	<meta charset="utf-8"/>
	<link rel="stylesheet" href="css/bootstrap.css"/>
</head>
<body>
<div class="container-fluid">

	<%@include file="header.jsp"%>

	<br><br>

	<form id="psForm" onsubmit="return checkpassword()" class="form-horizontal" action="adminReset" method="post" >
		<input type="hidden" name="id" value="${admin.id}">
		<input type="hidden" name="username" value="${admin.username}">
		<div class="form-group">
			<label for="input_name" class="col-sm-1 control-label">用户名</label>
			<div class="col-sm-5">${username}</div>
		</div>
		<div class="form-group">
			<label for="input_pass" class="col-sm-1 control-label">原密码</label>
			<div class="col-sm-5">
				<input type="password" class="form-control" id="input_pass" name="password" required="required">
			</div>
		</div>
		<div class="form-group">
			<label for="input_pass_new" class="col-sm-1 control-label">新密码</label>
			<div class="col-sm-5">
				<input  type="password" class="form-control" id="input_pass2" name="passwordNew" required="required">
			</div>
		</div>
		<div class="form-group">
			<label for="input_pass_new" class="col-sm-1 control-label">确认新密码</label>
			<div class="col-sm-5">
				<input id="pwNew2" type="password" class="form-control"  name="passwordNew2" required="required">
			</div>
		</div>
		<div class="form-group">
			<div class="col-sm-offset-1 col-sm-10">
				<button type="submit" form="psForm" class="btn btn-success">提交修改</button>
			</div>
		</div>
	</form>

	<span style="color:red;">${msg}</span>

</div>

<script>
	function checkpassword(){
		var i1 = document.getElementById("input_pass2");
		var p1 = i1.value;
		var i2 = document.getElementById("pwNew2");
		let p2 = i2.value;
		if (p1===p2){
			return true;
		}
		alert("两次新密码不匹配");
		return false;
	}
</script>
</body>
</html>